﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace TestEFAbstractEntity1.Migrations
{
    public partial class v1004 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_WorkNodes_WorkNodeEvents_Id",
                table: "WorkNodes");

            migrationBuilder.AddColumn<Guid>(
                name: "WorkNodeId",
                table: "WorkNodeEvents",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_WorkNodeEvents_WorkNodeId",
                table: "WorkNodeEvents",
                column: "WorkNodeId");

            migrationBuilder.AddForeignKey(
                name: "FK_WorkNodeEvents_WorkNodes_WorkNodeId",
                table: "WorkNodeEvents",
                column: "WorkNodeId",
                principalTable: "WorkNodes",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_WorkNodeEvents_WorkNodes_WorkNodeId",
                table: "WorkNodeEvents");

            migrationBuilder.DropIndex(
                name: "IX_WorkNodeEvents_WorkNodeId",
                table: "WorkNodeEvents");

            migrationBuilder.DropColumn(
                name: "WorkNodeId",
                table: "WorkNodeEvents");

            migrationBuilder.AddForeignKey(
                name: "FK_WorkNodes_WorkNodeEvents_Id",
                table: "WorkNodes",
                column: "Id",
                principalTable: "WorkNodeEvents",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
